package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the COST_CONTRACTS database table.
 * 
 */
@Embeddable
public class CostContractPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="CONTRACT_TYPE", unique=true, nullable=false, length=2)
	private String contractType;

	@Column(name="CONTRACT_SERIES", unique=true, nullable=false, length=4)
	private String contractSeries;

	@Column(name="CONTRACT_NUMBER", unique=true, nullable=false, precision=6)
	private long contractNumber;

    public CostContractPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getContractType() {
		return this.contractType;
	}
	public void setContractType(String contractType) {
		this.contractType = contractType;
	}
	public String getContractSeries() {
		return this.contractSeries;
	}
	public void setContractSeries(String contractSeries) {
		this.contractSeries = contractSeries;
	}
	public long getContractNumber() {
		return this.contractNumber;
	}
	public void setContractNumber(long contractNumber) {
		this.contractNumber = contractNumber;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CostContractPK)) {
			return false;
		}
		CostContractPK castOther = (CostContractPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.contractType.equals(castOther.contractType)
			&& this.contractSeries.equals(castOther.contractSeries)
			&& (this.contractNumber == castOther.contractNumber);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.contractType.hashCode();
		hash = hash * prime + this.contractSeries.hashCode();
		hash = hash * prime + ((int) (this.contractNumber ^ (this.contractNumber >>> 32)));
		
		return hash;
    }
}